feat: remove workflows namespace from SDK#898
feat: remove workflows namespace from SDK#898vcapretz wants to merge 1 commit intopreview-workflowsfrom
Conversation
commit: |
There was a problem hiding this comment.
4 issues found across 44 files
Confidence score: 3/5
- Test files
src/events/events.spec.tsandsrc/automations/automations.spec.tsinclude API-key-shaped secrets; even if placeholders, this is a security/process risk and should be replaced with clearly fake values. - There’s some maintainability risk from duplicated e2e logic in
integrations/integrations.spec.ts, which could drift over time. - Given the high-severity secret-pattern findings, this is a moderate-risk merge until those placeholders are cleaned up.
- Pay close attention to
src/events/events.spec.ts,src/automations/automations.spec.ts,integrations/integrations.spec.ts,integrations/nextjs/app/route.js- secret-like tokens, duplicated tests, and dead code.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="integrations/nextjs/app/route.js">
<violation number="1" location="integrations/nextjs/app/route.js:4">
P3: This creates a `Resend` client but never uses it, so the line is dead code in the request path.</violation>
</file>
<file name="src/events/events.spec.ts">
<violation number="1" location="src/events/events.spec.ts:15">
P1: Do not commit API key-shaped secrets in test files; replace this with a clearly non-secret placeholder.
(Based on your team's feedback about redacting secrets in committed artifacts.) [FEEDBACK_USED]</violation>
</file>
<file name="src/automations/automations.spec.ts">
<violation number="1" location="src/automations/automations.spec.ts:17">
P2: Avoid committing API-key-like tokens in test code; replace with a clearly fake placeholder sourced from a test constant/env.
(Based on your team's feedback about redacting secrets from test artifacts.) [FEEDBACK_USED]</violation>
</file>
<file name="integrations/integrations.spec.ts">
<violation number="1" location="integrations/integrations.spec.ts:6">
P2: This file duplicates the existing e2e integration test logic almost verbatim; extract shared test logic or keep a single canonical test file to avoid divergence.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| const fetchMocker = createFetchMock(vi); | ||
| fetchMocker.enableMocks(); | ||
|
|
||
| const resend = new Resend('re_zKa4RCko_Lhm9ost2YjNCctnPjbLw8Nop'); |
There was a problem hiding this comment.
P1: Do not commit API key-shaped secrets in test files; replace this with a clearly non-secret placeholder.
(Based on your team's feedback about redacting secrets in committed artifacts.)
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/events/events.spec.ts, line 15:
<comment>Do not commit API key-shaped secrets in test files; replace this with a clearly non-secret placeholder.
(Based on your team's feedback about redacting secrets in committed artifacts.) </comment>
<file context>
@@ -0,0 +1,421 @@
+const fetchMocker = createFetchMock(vi);
+fetchMocker.enableMocks();
+
+const resend = new Resend('re_zKa4RCko_Lhm9ost2YjNCctnPjbLw8Nop');
+
+describe('Events', () => {
</file context>
| const fetchMocker = createFetchMock(vi); | ||
| fetchMocker.enableMocks(); | ||
|
|
||
| const resend = new Resend('re_zKa4RCko_Lhm9ost2YjNCctnPjbLw8Nop'); |
There was a problem hiding this comment.
P2: Avoid committing API-key-like tokens in test code; replace with a clearly fake placeholder sourced from a test constant/env.
(Based on your team's feedback about redacting secrets from test artifacts.)
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/automations/automations.spec.ts, line 17:
<comment>Avoid committing API-key-like tokens in test code; replace with a clearly fake placeholder sourced from a test constant/env.
(Based on your team's feedback about redacting secrets from test artifacts.) </comment>
<file context>
@@ -0,0 +1,403 @@
+const fetchMocker = createFetchMock(vi);
+fetchMocker.enableMocks();
+
+const resend = new Resend('re_zKa4RCko_Lhm9ost2YjNCctnPjbLw8Nop');
+
+afterEach(() => fetchMock.resetMocks());
</file context>
| import os from 'node:os'; | ||
| import path from 'node:path'; | ||
|
|
||
| describe('integrations', () => { |
There was a problem hiding this comment.
P2: This file duplicates the existing e2e integration test logic almost verbatim; extract shared test logic or keep a single canonical test file to avoid divergence.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At integrations/integrations.spec.ts, line 6:
<comment>This file duplicates the existing e2e integration test logic almost verbatim; extract shared test logic or keep a single canonical test file to avoid divergence.</comment>
<file context>
@@ -0,0 +1,89 @@
+import os from 'node:os';
+import path from 'node:path';
+
+describe('integrations', () => {
+ const sdkPath = path.resolve(__dirname, '..');
+
</file context>
| import { Resend } from 'resend'; | ||
|
|
||
| export function GET() { | ||
| new Resend(''); |
There was a problem hiding this comment.
P3: This creates a Resend client but never uses it, so the line is dead code in the request path.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At integrations/nextjs/app/route.js, line 4:
<comment>This creates a `Resend` client but never uses it, so the line is dead code in the request path.</comment>
<file context>
@@ -0,0 +1,7 @@
+import { Resend } from 'resend';
+
+export function GET() {
+ new Resend('');
+
+ return new Response('Hello from this API route!', { status: 200 });
</file context>
Remove the duplicate 'workflows' namespace from the SDK. The preview-workflows branch had both 'workflows' and 'automations' namespaces pointing to the same /automations API endpoints. This commit removes: - src/workflows/ (Workflows class, interfaces, specs) - src/workflow-runs/ (WorkflowRuns class, interfaces, specs) - src/workflow-run-steps/ (WorkflowRunSteps class, interfaces, specs) - workflows property from Resend client - workflow-related exports from index.ts The 'automations' namespace (automations, automation-runs, automation-run-steps) is preserved as the canonical SDK interface for these endpoints. Also fixes a stale test describe name and test data in parse-automation-to-api-options.spec.ts. Co-authored-by: Vitor Capretz <capretzvitor@gmail.com>
7b880ad to
b3be0eb
Compare
Summary
Removes the duplicate
workflowsnamespace from the SDK. Thepreview-workflowsbranch had bothworkflowsandautomationsnamespaces pointing to the same/automationsAPI endpoints. This PR removes theworkflows-named duplicate, keeping onlyautomationsas the canonical SDK interface.Changes
Deleted directories
src/workflows/—Workflowsclass, all interfaces (CreateWorkflowOptions,GetWorkflow,ListWorkflows,RemoveWorkflow,UpdateWorkflow,WorkflowStep,Workflow), and spec filesrc/workflow-runs/—WorkflowRunsclass, all interfaces (GetWorkflowRun,ListWorkflowRuns,WorkflowRun), and spec filesrc/workflow-run-steps/—WorkflowRunStepsclass, all interfaces (GetWorkflowRunStep,ListWorkflowRunSteps,WorkflowRunStep), and spec fileModified files
src/resend.ts— RemovedWorkflowsimport andreadonly workflowsproperty fromResendclientsrc/index.ts— Removed re-exports forworkflow-run-steps,workflow-runs, andworkflowsinterfacessrc/common/utils/parse-automation-to-api-options.spec.ts— Fixed staleparseWorkflowEventToApiOptionsdescribe name →parseEventToApiOptions, and updated test data name from'Minimal Workflow'to'Minimal Automation'What's preserved
automationsnamespace (src/automations/,src/automation-runs/,src/automation-run-steps/) — unchangedeventsnamespace (src/events/) — unchanged (note: theworkflow_eventstring inSendEventResponseSuccess.objectis an API response type literal, not SDK namespace code)Verification
workflow_eventAPI response typeSlack Thread
Summary by cubic
Removed the duplicate
workflowsnamespace and madeautomationsthe single SDK interface. Also added a neweventsAPI with send and CRUD support.New Features
resend.automationswith create/list/get/update/remove, plusresend.automations.runsandresend.automations.runs.steps(get/list).resend.eventswith send/create/get/list/update/remove.automations,automation-runs,automation-run-steps, andevents.Migration
resend.workflowswithresend.automations.resend.workflows.runs[.steps]→resend.automations.runs[.steps].Workflow*→Automation*,WorkflowRun*→AutomationRun*,WorkflowRunStep*→AutomationRunStep*. Note:workflow_eventremains an API response literal.Written for commit b3be0eb. Summary will update on new commits.